<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>模块化</title>
</head>

<body>
    <script>
        var moduleA;
        moduleA = function () {
            var prop = 1;

            function func() { }

            return {
                func: func,
                prop: prop
            };
        }(); // 立即执行匿名函数
        console.log(moduleA);
    </script>
</body>

</html>